<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // 要求：
        // 实现数组去重：
        var arr = ["red", "green", "blue", "red", "100px", "99px", 100, "green"];
        // 把arr中重复的数据去掉


        function unique(she) {
            // 遍历arr，把元素分别放入tmp数组(不存在才放)
            var tmp = new Array();
            for (var i in she) {
                //该元素在tmp内部不存在才允许追加
                if (tmp.indexOf(she[i]) == -1) {
                    tmp.push(she[i]);
                }
            }
            return tmp;
        }
        var she = unique(arr);
        console.log(she);
        document.write(she);
    </script>
</body>

</html>